
public abstract class Roboter implements RoboterType{

	/**
	 * Roboter Static Information
	 */
	private static Integer roboterId = 0;
	
	private static Integer getRoboterId() {
		return (++roboterId);
	}
	
	public enum Type{RAUPENROBOTER, SCHWENKARMROBOTER}
	public enum Role{SCHWEISROBOTER,LACKIERROBOTER}
	
	public static Roboter createRoboter(Type type){
		Roboter factored = null;
		switch(type){
		case RAUPENROBOTER:
			factored = new Raupenroboter();
			break;
		case SCHWENKARMROBOTER:
			factored = new Schwenkarmroboter();
			break;
		}
		return factored;
	}
	
	public static RoboterRole createRoboterRole(Role role){
		RoboterRole factored = null;
		switch(role){
		case SCHWEISROBOTER:
			factored = new Schweisroboter();
			break;
		case LACKIERROBOTER:
			factored = new Lackierroboter();
			break;
		}
		return factored;
	}
	
	/**
	 * Roboter Instance Information
	 */
	public final Integer ID;
	private Integer operatingHours;
	
	protected Roboter() {
		ID = Roboter.getRoboterId();
		operatingHours = 0;
	}
	
	public int getOperatingHours() {
		return operatingHours;
	}
	
	public void increaseOperatingHours(Integer hours) {
		if(hours == null || hours < 0) {
			throw new IllegalArgumentException();
		}
		operatingHours += hours;
	}

	public int getID(){
		return this.ID;
	}
	
	/**
	 * Roboter Role Information
	 */
	private RoboterRole role;
	
	public void setRoboterRole(RoboterRole _role){
		this.role = _role;
	}

	public RoboterRole getRoboterRole(){
		return this.role;
	}
	/**
	 * distinction of different roboters
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((ID == null) ? 0 : ID.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Roboter other = (Roboter) obj;
		if (ID == null) {
			if (other.ID != null) {
				return false;
			}
		} else if (!ID.equals(other.ID)) {
			return false;
		}
		return true;
	}
}
